<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://www.sf.net/frails" prefix="fr"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>


<f:view>
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
		<head>
			<meta http-equiv="pragma" content="no-cache" />
			<meta http-equiv="cache-control" content="no-cache" />
			<meta http-equiv="expires" content="0" />
			<link href="../css/iframe.css" rel="stylesheet" type="text/css" />
		</head>
		<body>
		<body>
			<object classid="clsid:A11682FD-01E7-48E6-96FA-A7268B0B8E57" id="CorsicanCorridor1">
				<param name="_Version" value="65536">
				<param name="_ExtentX" value="2646">
				<param name="_ExtentY" value="1323">
				<param name="_StockProps" value="0">
				<param name="License" value="vivo;2008-01-31;2008-08-31;ODRL">
				<param name="UserName" value="vivo">
				<param name="UserPass" value="vivo">
				<param name="Input" value="sample.mpg">
				<param name="Output" value="tsenc.mpg">
				<param name="XMLFileName" value="EncoderInfo.xml">
				<param name="EncMethod" value="ctr">
			</object>

			<div id="container">
				<div class="titles">
					<h:outputText value="解密节目"></h:outputText>
				</div>
				<div>
					<h:messages />
				</div>
				<h:form enctype="multipart/form-data" id="file">
					<script type="text/javascript">
							function encrpyt()
							{
								var cc1 = document.getElementById("CorsicanCorridor1");
								var statusbar = document.getElementById("statusbar");
								
								var fileform = document.file;
								var files = fileform.getElementsByTagName("Input");


								for(var i=0;i<files.length;i++){
									var file = files[i];
									if(file.type=="file" && file.value !="" && file.name!="fp12"){
							
										// judge
										//alert("Encrypt File : "+file.value+"|"+file.name);
										cc1.Input=file.value;
										cc1.Output=file.value+".decrypt.mpg";
										var ret = cc1.Decode();
									
										if(ret==0){
											alert("Decrypt Success ! " + ret);
										}else{
											alert("Decrypt Failed ! " + ret);
										}
										if(statusbar!=null){
											statusbar.value=statusbar.value+"||||";
										}
									}
								}
							}
							
							function cancel()
							{
								var cc1 = document.getElementById("CorsicanCorridor1");
								cc1.Input=file;
								var ret = cc1.Cancel();
								alert(ret);
							}
				
							function addfile()
							{
							
								var filediv = document.getElementById("filediv");
								var filetemplate = document.getElementById("filetemplate");
								//var newfile = filetemplate.cloneNode();
								//newfile.style.display="";
								//filediv.appendChild(newfile);
								 filediv.innerHTML=filediv.innerHTML+"<div><input type='file' id='fe' name='fe' /></div>";
							}
							function deletefile(thisfile)
							{
								alert(thisfile.outerHTML);
							}
					</script>

					<div>
						<span><h:outputLabel value="请选择要解密的文件:"></h:outputLabel> </span>
					</div>
					<div style="clear: both;"></div>
					<div class="userinformation">
						<div>
							<BR />
						</div>
						<div id="filediv">
							<div id="aa">
								<input type="file" id="fe" name="fe" />
							</div>
						</div>
						<div>
							<input type="button" name="encrypt" onclick="encrpyt()" value="解密"></input>
							<input type="button" name="cancel" value="cancel()" value="取消"></input>
						</div>
						<div>
							<input type="text" id="statusbar" name="statusbar" value="" style="width: 200px; border: solid 1px #aaeeaa;"></input>
						</div>
					</div>
				</h:form>
			</div>
		</body>
	</html>
</f:view>
